<template>
  <div class="base-info-form" :style="props.formStyle">
    <el-form
      class="baseinfo"
      :model="ruleForm"
      :inline="true"
      ref="formRef"
      label-width="85px"
    >
      <TagIcon v-if="props.showTitle" :title="props.title" />
      <el-row :gutter="24">
        <el-col :span="8">
          <el-form-item
            label="作战场景"
            prop="operatingScen"
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'change',
            }"
          >
            <el-select
              v-model="ruleForm.operatingScen"
              clearable
              placeholder="请选择"
              :disabled="true"
            >
              <el-option label="对地" value="对地" />
              <el-option label="对海" value="对海" />
              <el-option label="对空" value="对空" />
            </el-select>
          </el-form-item>
          <el-form-item
            label="干扰类型"
            prop="interType"
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'change',
            }"
          >
            <el-select
              v-model="ruleForm.interType"
              clearable
              placeholder="请选择"
              :disabled="true"
            >
              <el-option label="舰载有源干扰-雷达" value="舰载有源干扰-雷达" />
              <el-option label="舷外有源干扰-雷达" value="舷外有源干扰-雷达" />
              <el-option label="箔条干扰-雷达" value="箔条干扰-雷达" />
              <el-option label="角反干扰-雷达" value="角反干扰-雷达" />
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item
            label="导引头体制"
            label-width="135px"
            prop="dytStyle"
          
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'change',
            }"
          >
            <el-select
              v-model="ruleForm.dytStyle"
              clearable
              placeholder="请选择"
              :disabled="true"
            >
              <el-option label="雷达(主动)" value="雷达(主动)" />
              <el-option label="雷达(被动)" value="雷达(被动)" />
              <el-option label="红外" value="红外" />
              <el-option label="雷达-红外符合制导" value="雷达-红外符合制导" />
            </el-select>
          </el-form-item>
          <el-form-item
            label="外军电子战备类型"
            label-width="135px"
            prop="foreignElectEquip"
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'change',
            }"
          >
            <el-select
              v-model="ruleForm.foreignElectEquip"
              clearable
              placeholder="请选择"
              :disabled="true"
            >
              <el-option label="舰载有源干扰" value="舰载有源干扰" />
              <el-option label="舷外有源干扰" value="舷外有源干扰" />
              <el-option label="角反干扰" value="角反干扰" />
            </el-select>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item
            label="干扰场景类型"
            label-width="135px"
            prop="interScenType"
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'change',
            }"
          >
            <el-select
              v-model="ruleForm.interScenType"
              clearable
              placeholder="请选择"
              :disabled="true"
            >
              <el-option label="单一干扰" value="单一干扰" />
              <el-option label="组合干扰" value="组合干扰" />
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, reactive, ref, watch } from 'vue';
import TagIcon from '@/components/tag-icon/index.vue';
import { getSampleDataInfo } from '@/api/testSampleData';
const props = defineProps({
  sampleId: {
    type: String,
    required: true,
  },
  dataSource: {
    type: Object,
    default: () => {
      return {
        operatingScen: '',
        dytStyle: '',
        interScenType: '',
        interType: '',
        foreignElectEquip: '',
      };
    },
  },
  formStyle: {
    type: Object,
    default: () => {
      return { padding: '16px' };
    },
  },
  title: {
    type: String,
    default: '试验样本基础信息'
  },
  // 是否显示标题
  showTitle: {
    type: Boolean,
    default: true
  }
});
const tagIconStyle = reactive({ paddingLeft: '16px', paddingBottom: 0 });
let ruleForm = ref<any>({
  operatingScen: '',
  dytStyle: '',
  interScenType: '',
  interType: '',
  foreignElectEquip: '',
});

onMounted(() => {
 
  getSampleDataInfo({sampleId: props.sampleId}).then((res) => {
      const data = res.data.sampleBaseInfoVO;
      ruleForm.value = {
        operatingScen: data.operatingScen || '',
        dytStyle: data.dytStyle || '',
        interScenType: data.interScenType || '',
        interType: data.interType || '',
        foreignElectEquip: data.foreignElectEquip || '',
      };
    });
});
</script>

<style lang="scss" scoped>
</style>
